import mysql.connector


def dosql(sql):
    conn = mysql.connector.connect(host="59.111.94.156", port="13308", user="paperless",
                                   password="xHUuCLmUO3VkYFYwvTl3",
                                   database="paperless_db")
    cursor = conn.cursor()
    # cursor.execute("SELECT t.user_id,t.username,t.nickname,t.create_time  FROM sys_user t LIMIT 100")
    cursor.execute(sql)
    values = cursor.fetchall()
    cursor.close()
    conn.close()
    return values


class UserService(object):

    def listUser(self):
        return dosql("SELECT t.user_id as userId,t.username,t.nickname FROM sys_user t LIMIT 100")
